---
layout: single
property_name: white-space
---

<section id="white-space" class="property">
  <header class="property-header">
    <nav class="property-links">
        <a class="property-collection" href="{{site.url}}/typography/">
          In collection: <strong>typography</strong>
        </a>
      <a class="property-links-direct" href="{{site.url}}/property/white-space/" data-property-name="white-space" data-tooltip="Single page for this property">Permalink</a>
      <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="white-space">Share</a>
      <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/white-space" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a>
    </nav>
    <h2 class="property-name">
      <a href="#white-space"><span>#</span>white-space</a>
    </h2>
    <div class="property-description">
      <p>Defines how the element&#39;s white space is handled.</p>

    </div>

  </header>

    <style type="text/css">.white-space { font-family: "Source Code Pro", monospace;font-size: 0.7rem;width: 18em; }</style>




    <section class="example">
      <header class="example-header">
        <p class="example-name">
            <code class="example-default" data-tooltip="This is the property's default value">default</code>


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="white-space: normal;">white-space: normal;</code>
        </p>
        <div class="example-description">
          <p>Sequences of spaces are combined into one.<br>Line breaks are ignored.<br>The text content is wrapped.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div white-space  block block--alpha" id="white-space-normal">#parent .selector ul li blockquote{
  color: red;
  font-size: 1rem;
}</div>
        </div>
      </aside>
          <style type="text/css">#white-space-normal{ white-space:normal;}</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="white-space: nowrap;">white-space: nowrap;</code>
        </p>
        <div class="example-description">
          <p>Sequences of spaces are combined into one.<br>Line breaks are ignored.<br>The text content is <strong>not</strong> wrapped and remains on a <strong>single line</strong>.</p>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div white-space  block block--alpha" id="white-space-nowrap">#parent .selector ul li blockquote{
  color: red;
  font-size: 1rem;
}</div>
        </div>
      </aside>
          <style type="text/css">#white-space-nowrap{ white-space:nowrap;}</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="white-space: pre;">white-space: pre;</code>
        </p>
        <div class="example-description">
          <p>The white space is <strong>exactly preserved</strong>.</p>
<ul>
<li>Sequences of spaces are preserved</li>
<li>Lines break only on new lines and <code>&lt;br&gt;</code></li>
</ul>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div white-space  block block--alpha" id="white-space-pre">#parent .selector ul li blockquote{
  color: red;
  font-size: 1rem;
}</div>
        </div>
      </aside>
          <style type="text/css">#white-space-pre{ white-space:pre;}</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="white-space: pre-wrap;">white-space: pre-wrap;</code>
        </p>
        <div class="example-description">
          <p>The white space is <strong>mostly preserved</strong>.</p>
<ul>
<li>Sequences of spaces are preserved</li>
<li>Lines break on new lines, <code>&lt;br&gt;</code>, but also when reaching the end of the element</li>
</ul>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div white-space  block block--alpha" id="white-space-pre-wrap">#parent .selector ul li blockquote{
  color: red;
  font-size: 1rem;
}</div>
        </div>
      </aside>
          <style type="text/css">#white-space-pre-wrap{ white-space:pre-wrap;}</style>
    </section>
    <section class="example">
      <header class="example-header">
        <p class="example-name">


          <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="white-space: pre-line;">white-space: pre-line;</code>
        </p>
        <div class="example-description">
          <p>Only <strong>new lines</strong> are preserved.</p>
<ul>
<li>Sequences of spaces are <strong>combined</strong> into one</li>
<li>Lines break on new lines, <code>&lt;br&gt;</code>, but also when reaching the end of the element</li>
</ul>

        </div>
      </header>

      <aside class="example-preview">
        <div class="example-browser"><i></i><i></i><i></i></div>
        <div class="example-output">
          <div class="example-output-div white-space  block block--alpha" id="white-space-pre-line">#parent .selector ul li blockquote{
  color: red;
  font-size: 1rem;
}</div>
        </div>
      </aside>
          <style type="text/css">#white-space-pre-line{ white-space:pre-line;}</style>
    </section>

</section>
